//
//  OldPhotoMainController.m
//  OldPhoto
//
//  Created by 蓝鳍互娱 on 2024/7/29.
//

#import "OldPhotoMainController.h"
#import "OldPhotoVipController.h"
#import "OldPhotoMainVipView.h"
@interface OldPhotoMainController ()
@property (nonatomic,strong) UILabel *oldPhotoUserIcpLab;
//@property (nonatomic,strong) OldPhotoMainVipView *oldPhotoMainVipView;
@end
@implementation OldPhotoMainController
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = OldPhotoHex(@"#F8F8FB");
    [self creatOldPhotoNavView];
    self.oldPhotoNavTitle = @"我的";
}
- (void)creatOldPhotoInitView{
    UIImageView * oldPhotoMainTopImgView = [[UIImageView alloc] init];
    oldPhotoMainTopImgView.image = OldPhotoImageNamed(@"OldPhotoMainTopBg");
    oldPhotoMainTopImgView.userInteractionEnabled = true;
    [self.view addSubview:oldPhotoMainTopImgView];
    [oldPhotoMainTopImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(OldPhotoRatio(0)));
        make.right.equalTo(@(OldPhotoRatio(0)));
        make.top.equalTo(@(OldPhotoRatio(0)));
        make.height.equalTo(@(OldPhotoRatio(510)));
    }];
//    self.oldPhotoMainVipView = [[OldPhotoMainVipView alloc] init];
//    [self.view addSubview:self.oldPhotoMainVipView];
//    [self.oldPhotoMainVipView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(@(OldPhotoRatio(29)));
//        make.right.equalTo(@(-OldPhotoRatio(29)));
//        make.top.equalTo(@(OldPhotoRatio(118) + OldPhotoTopSafeHeight));
//        make.height.equalTo(@(OldPhotoRatio(145)));
//    }];
    UIButton * oldPhotoMainUserBtn = [[UIButton alloc] init];
    [oldPhotoMainUserBtn setBackgroundImage:OldPhotoImageNamed(@"OldPhotoMainUserBg") forState:UIControlStateNormal];
    [oldPhotoMainUserBtn addTarget:self action:@selector(oldPhotoMainUser) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:oldPhotoMainUserBtn];
    [oldPhotoMainUserBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(OldPhotoRatio(24)));
        make.right.equalTo(@(-OldPhotoRatio(24)));
//        make.top.equalTo(self.oldPhotoMainVipView.mas_bottom).offset(OldPhotoRatio(20));
        make.top.equalTo(@(OldPhotoRatio(118) + OldPhotoTopSafeHeight));
        make.height.equalTo(@(OldPhotoRatio(96)));
    }];
    UIButton * oldPhotoMainPriBtn = [[UIButton alloc] init];
    [oldPhotoMainPriBtn setBackgroundImage:OldPhotoImageNamed(@"OldPhotoMainPriBg") forState:UIControlStateNormal];
    [oldPhotoMainPriBtn addTarget:self action:@selector(oldPhotoMainPri) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:oldPhotoMainPriBtn];
    [oldPhotoMainPriBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(OldPhotoRatio(24)));
        make.right.equalTo(@(-OldPhotoRatio(24)));
        make.top.equalTo(oldPhotoMainUserBtn.mas_bottom).offset(OldPhotoRatio(16));
        make.height.equalTo(@(OldPhotoRatio(96)));
    }];
    self.oldPhotoUserIcpLab = [[UILabel alloc] init];
    self.oldPhotoUserIcpLab.textColor = OldPhotoHex(@"#BEBEBE");
    self.oldPhotoUserIcpLab.font = [UIFont systemFontOfSize:OldPhotoRatio(20) weight:UIFontWeightRegular];
    self.oldPhotoUserIcpLab.numberOfLines = 2;
    self.oldPhotoUserIcpLab.textAlignment = NSTextAlignmentCenter;
    self.oldPhotoUserIcpLab.text = [OldPhotoDataManger defaultManger].icp;
    [self.view addSubview:self.oldPhotoUserIcpLab];
    [self.oldPhotoUserIcpLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.bottom.equalTo(@(-OldPhotoTabBarHeight - OldPhotoRatio(50)));
    }];
    UIButton * oldPhotoUserIcpBtn = [[UIButton alloc] init];
    [oldPhotoUserIcpBtn addTarget:self action:@selector(oldPhotoUserIcp) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:oldPhotoUserIcpBtn];
    [oldPhotoUserIcpBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.oldPhotoUserIcpLab);
    }];
}
- (void)oldPhotoUserIcp{
    if ([OldPhotoDataManger defaultManger].icp.length > 0) {
        OldPhotoWebController * oldPhotoWebCtrl = [[OldPhotoWebController alloc] init];
        oldPhotoWebCtrl.isHidNavBack = false;
        oldPhotoWebCtrl.oldPhotoWebUrl = @"https://beian.miit.gov.cn/";
        [self.navigationController pushViewController:oldPhotoWebCtrl animated:true];
    }
}
- (void)oldPhotoMainUser{
    OldPhotoWebController * oldPhotoWebCtrl = [[OldPhotoWebController alloc] init];
    oldPhotoWebCtrl.isHidNavBack = false;
    oldPhotoWebCtrl.oldPhotoWebUrl = @"https://lgg69az5eh.feishu.cn/docx/AS2pdKKGooaomTxST2lc9o0SnNf?from=from_copylink";
    [self.navigationController pushViewController:oldPhotoWebCtrl animated:true];
}
- (void)oldPhotoMainPri{
    OldPhotoWebController * oldPhotoWebCtrl = [[OldPhotoWebController alloc] init];
    oldPhotoWebCtrl.isHidNavBack = false;
    oldPhotoWebCtrl.oldPhotoWebUrl = @"https://lgg69az5eh.feishu.cn/docx/XTn6d3mFio0c4QxDkc6cRfoOntd?from=from_copylink";
    [self.navigationController pushViewController:oldPhotoWebCtrl animated:true];
}
@end
